<html>
<head><meta charset="utf-8"><title>Procedure for adding an error code · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html">Procedure for adding an error code</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="180069493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180069493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180069493">(Nov 06 2019 at 19:42)</a>:</h4>
<p>Are there instructions somewhere for what to do to add an error code to the compiler?</p>



<a name="180069523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180069523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180069523">(Nov 06 2019 at 19:43)</a>:</h4>
<p>The diagnostics section of the rustc guide doesn't seem to have anything pertinent</p>



<a name="180183479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180183479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180183479">(Nov 07 2019 at 22:26)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="210316">@GuillaumeGomez</span> I think?</p>



<a name="180183538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180183538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180183538">(Nov 07 2019 at 22:26)</a>:</h4>
<p>Also, when you find out, a PR to the rustc-guide would be much appreciated</p>



<a name="180183931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180183931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180183931">(Nov 07 2019 at 22:31)</a>:</h4>
<p>I think I never wrote about it...</p>



<a name="180184060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180184060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180184060">(Nov 07 2019 at 22:32)</a>:</h4>
<p>But to put it simply: find the highest error code number (E0XXX), then add it into the <a href="http://error_code.rs" target="_blank" title="http://error_code.rs">error_code.rs</a> file of the lib you're currently modifying</p>



<a name="180184069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180184069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180184069">(Nov 07 2019 at 22:32)</a>:</h4>
<p>also please add the long error explanation, that'd make my life a lot simpler</p>



<a name="180191530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180191530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180191530">(Nov 08 2019 at 00:20)</a>:</h4>
<p><span class="user-mention" data-user-id="210316">@GuillaumeGomez</span>  That's pretty much what I <a href="https://github.com/rust-lang/rust/pull/66170/commits/d8e1cc07065f46dcae6ba98bb73536ad6115f1d5" target="_blank" title="https://github.com/rust-lang/rust/pull/66170/commits/d8e1cc07065f46dcae6ba98bb73536ad6115f1d5">ended up doing</a>.</p>
<p>Is there a reason that error codes are split across crates instead of combined into a single one e.g.,<code>librustc_errors</code>? Seems like doing so would make this easier, as well as move some code out of <code>librustc</code> and <code>libsyntax</code>, which are on the <a href="http://gistpreview.github.io/?74d799739504232991c49607d5ce748a" target="_blank" title="http://gistpreview.github.io/?74d799739504232991c49607d5ce748a">critical path</a> when building <code>rustc</code>.</p>



<a name="180207562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180207562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180207562">(Nov 08 2019 at 07:06)</a>:</h4>
<p><span class="user-mention" data-user-id="118594">@ecstatic-morse</span> +100 -- would be much smoother! also e.g. when splitting crates</p>



<a name="180207565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180207565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180207565">(Nov 08 2019 at 07:07)</a>:</h4>
<p>I'll make an issue for this to discuss (<a href="https://github.com/rust-lang/rust/issues/66210" target="_blank" title="https://github.com/rust-lang/rust/issues/66210">#66210</a>)</p>



<a name="180215589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180215589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180215589">(Nov 08 2019 at 09:52)</a>:</h4>
<p>I answered on the issue why I don't think it's a good idea.</p>



<a name="180216540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180216540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> centril <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180216540">(Nov 08 2019 at 10:07)</a>:</h4>
<p>Thanks</p>



<a name="180270702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180270702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180270702">(Nov 08 2019 at 20:53)</a>:</h4>
<blockquote>
<p>also please add the long error explanation, that'd make my life a lot simpler</p>
</blockquote>
<p>there is an accepted RFC somewhere that <span class="user-mention" data-user-id="210316">@GuillaumeGomez</span> giving the general format; if/when you document in the rustc-guide, <span class="user-mention" data-user-id="118594">@ecstatic-morse</span>, can you include some of that template?</p>



<a name="180277731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Procedure%20for%20adding%20an%20error%20code/near/180277731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Procedure.20for.20adding.20an.20error.20code.html#180277731">(Nov 08 2019 at 22:11)</a>:</h4>
<p>I knew I had something! Having documentation pointing to it would definitely be useful.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>